package com.nbsaas.boot.tech.rest.convert;

import com.nbsaas.boot.tech.data.entity.Technology;
import com.nbsaas.boot.tech.api.domain.request.TechnologyRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.user.data.entity.UserInfo;

/**
* 技术请求对象转换成实体对象
*/

public class TechnologyEntityConvert  implements Converter<Technology, TechnologyRequest> {

    @Override
    public Technology convert(TechnologyRequest source) {
        Technology result = new Technology();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getCreator()!=null){
                    UserInfo creator =new UserInfo();
                    creator.setId(source.getCreator());
                    result.setCreator(creator);
                    }
        return result;
    }
}

